<?php
namespace Api\Controller;
use Think\Controller;
/*
	文件使用说明：微信测试接口文件
*/
class TestController extends Controller {
	
    public function index(){
		
		//$row = M('Wechats')->where(1)->field('token,original')->find();
		$array_row = M('Options')->where(array('option_name'=>'weixin_array'))->find();
		
		$array_row = unserialize($array_row['option_value']);
			
		$row['token']   = $array_row['token'];
		$row['original']= $array_row['original'];
		
		//var_dump(1);die;
		$timestamp = NOW_TIME;
		$nonce = random(5);
		$token = $row['token'];
		$signkey = array($token, $timestamp, $nonce);
		sort($signkey, SORT_STRING);
		$signString = implode($signkey);
		$signString = sha1($signString);
		
		$array = array(
			'signString'=>$signString,
			'nonce'=>$nonce,
			'original'=>$row['original'],
			'timestamp'=>$timestamp,
		);
		$this->assign($array);
		$this->display('test');
    }
	
	
	 
	
}